var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function n() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  AXEquipmentView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.onLoadItemEquimentFn = {
          caller: t,
          code: 1301,
          method: function (e) {
            if (0 == e.code) {
              t.list_equipment.scrollTo(0), (t.equipArr = e.list);
              for (var i, n = [], u = e.list, o = 0; o < u.length; o++)
                (i = {
                  lbl_equipment_name: {
                    text: u[o].name + "  " + u[o].price + " 两",
                  },
                  btn_equiment_item: { label: "购买" },
                  equiment_ID: u[o].id,
                }),
                  n.push(i);
              (t.list_equipment.visible = !0), (t.list_equipment.array = n);
            }
          },
        }),
        (t.onLoadEquimentDetailFn = {
          caller: t,
          code: 1297,
          method: function (e) {
            0 == e.code || ToastView.toastView(e.msg);
          },
        }),
        t.tab_equiment.on(Laya.Event.CLICK, t, t.onTabEquimenDidClickFn),
        t.tab_equ_second_wuqi.on(Laya.Event.CLICK, t, t.onTabEquimenDidClickFn),
        t.tab_equ_toukui.on(
          Laya.Event.CLICK,
          t,
          t.onTabEquimenTouKuiDidClickFn
        ),
        t.btn_equipmentBack.on(Laya.Event.CLICK, t, t.onquipmentBackFn),
        WebSocketService.addListener(t.onLoadItemEquimentFn),
        WebSocketService.addListener(t.onLoadEquimentDetailFn),
        (t.list_equipment.selectEnable = !0),
        t.list_equipment.on(Laya.Event.CLICK, t, t.onEquipmentDidClickFn),
        (t.list_equipment.vScrollBarSkin = ""),
        (t.list_equipment.renderHandler = new Laya.Handler(
          t,
          t.updateEquipmentItem
        )),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openEquipmentView = function () {
        return (
          null == this.equipMentVC && (this.equipMentVC = new t()),
          (this.equipMentVC.tab_equiment.selectedIndex = 0),
          (this.equipMentVC.tab_equ_second_wuqi.selectedIndex = -1),
          (this.equipMentVC.tab_equ_second_wuqi.visible = !0),
          (this.equipMentVC.tab_equ_toukui.visible = !1),
          WebSocketService.send({
            c: 1301,
            d: { type: 2, base: 0, pageNum: 0 },
          }),
          (this.equipMentVC.list_equipment.visible = !1),
          this.equipMentVC
        );
      }),
      (t.prototype.updateEquipmentItem = function (e, t) {}),
      (t.prototype.onTabEquimenDidClickFn = function (e) {
        var t = 2,
          i = this.tab_equiment.selectedIndex,
          n = !0;
        (this.tab_equ_toukui.visible = !1),
          0 == i
            ? (t = 2)
            : 1 == i
            ? (t = 3)
            : 2 == i
            ? ((t = 4), (n = !1))
            : 3 == i
            ? ((t = 5), (n = !1))
            : 4 == i
            ? ((this.tab_equ_toukui.visible = !0), (n = !1), (t = 1))
            : 5 == i && ((t = 6), (n = !1));
        var u = 0,
          o = this.tab_equ_second_wuqi.selectedIndex;
        0 == o && n
          ? (u = 1)
          : 1 == o && n
          ? (u = 2)
          : 2 == o && n
          ? (u = 3)
          : 3 == o && n
          ? (u = 4)
          : 4 == o && n && (u = 5),
          (this.tab_equ_second_wuqi.visible = n),
          WebSocketService.send({
            c: 1301,
            d: { type: t, base: u, pageNum: 0 },
          });
      }),
      (t.prototype.onTabEquimenTouKuiDidClickFn = function () {
        var e = this.tab_equ_toukui.selectedIndex,
          t = 0;
        0 == e ? (t = 2) : 1 == e ? (t = 1) : 2 == e && (t = 3),
          WebSocketService.send({
            c: 1301,
            d: { type: "1", base: t, pageNum: 0 },
          });
      }),
      (t.prototype.onEquipmentDidClickFn = function (e) {
        if ("" != e.target.name) {
          this.select_ID = this.equipArr[this.list_equipment.selectedIndex].id;
          var t = this.equipArr[this.list_equipment.selectedIndex],
            i = {
              name: t.name,
              thing_id: this.select_ID,
              count: 1,
              money: t.price,
            };
          DPItemDetailPageView.showItemDetailPageView(i, "AXEquipmentView");
        }
      }),
      (t.prototype.onquipmentBackFn = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.MarketController.AXEquipmentViewUI);
